import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  //源数据 就是 给这个路由添加一个属性控制显示对应的路由  mata 通过$route得到  mata 默认是空对象  空对象取值没有的话就是fasle  通过route.meta拿到图片
  {
    path: "/msite",
    component: () => import("views/Msite/Msite.vue"),
    meta: {
      showFooter: true,
    },
  },
  {
    path: "/search",
    component: () => import("views/Search/Search.vue"),
    meta: {
      showFooter: true,
    },
  },
  {
    path: "/order",
    component: () => import("views/Order/Order.vue"),
    meta: {
      showFooter: true,
    },
  },
  {
    path: "/profile",
    component: () => import("views/Profile/Profile.vue"),
    meta: {
      showFooter: true,
    },
  },
  {
    path: "/",
    redirect: "/msite",
  },
  {
    path: "/login",
    component: () => import("views/Login/Login.vue"),
  },
  {
    path: "/shop",
    component: () => import("views/Shop/shop.vue"),
    children: [
      {
        path: "/shop/goods",
        component: () => import("views/Shop/children/ShopGoods.vue"),
      },
      {
        path: "/shop/ratings",
        component: () => import("views/Shop/children/ShopRatings.vue"),
      },
      {
        path: "/shop/info",
        component: () => import("views/Shop/children/ShopInfo.vue"),
      },
      {
        path: '',
        redirect: '/shop/goods'
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
